/******************************************************************
 * Copyright(c)  : Industry.soufun.com 2013
 * Description   : Auto generat code 
 * CreateDate    : 2013-09-29
 * Creater       : Industry
 * LastChangeDate: 
 * LastChanger   : 
 * Version Info  : 1.0
 * ******************************************************************/
using System;
using System.Data;
using System.Collections.Generic;
using Industry.Proj.EntityCore;
using Industry.Proj.Data;
using Onlyle.Model;
using System.Data.SqlClient;

namespace Onlyle.DAO
{
    public class GaoXiao_ArticleDA
    {
		#region Add
		public static bool AddGaoXiao_Article(E_GaoXiao_Article GaoXiao_Article)
        {
            using(DataAccessBroker broker = DataAccessFactory.Instance())
            {
                try
                {
                    DataAccess.Insert(GaoXiao_Article,broker);
                    return true;
                }
                catch
                {
                    return false;
                }
            }
        }
        public static bool AddGaoXiao_Article(List<E_GaoXiao_Article> GaoXiao_Articlelist)
        {
            using(DataAccessBroker broker = DataAccessFactory.Instance())
            {
                return DataAccess.Insert<E_GaoXiao_Article>(GaoXiao_Articlelist, broker);
            }
        }
        #endregion
        
        #region Update

        public static bool UpDateGaoXiao_Article(E_GaoXiao_Article GaoXiao_Article)
        {
            using(DataAccessBroker broker = DataAccessFactory.Instance())
            {
                try
                {
                    DataAccess.Update(GaoXiao_Article,broker);
                    return true;
                }
                catch
                {
                 return false;
                }
            }
        }
        public static bool UpDateGaoXiao_Article(List<E_GaoXiao_Article> GaoXiao_Articlelist)
        {
            using(DataAccessBroker broker = DataAccessFactory.Instance())
            {
                return DataAccess.Update<E_GaoXiao_Article>(GaoXiao_Articlelist, broker);
            }
        }
        #endregion
        
        #region Delete
      
        public static bool DeleteGaoXiao_Article(E_GaoXiao_Article GaoXiao_Article)
        {
            using(DataAccessBroker broker = DataAccessFactory.Instance())
            {
                try
                {
                    DataAccess.Delete(GaoXiao_Article,broker);
                    return true;
                }
                catch
                {
                    return false;
                }
            }
        }
        public static bool DeleteGaoXiao_Article(List<E_GaoXiao_Article> GaoXiao_Articlelist)
        {
            using(DataAccessBroker broker = DataAccessFactory.Instance())
            {
                return DataAccess.Delete<E_GaoXiao_Article>(GaoXiao_Articlelist, broker);
            }
        }
        #endregion
        
        
        #region SELECT
        public static List<E_GaoXiao_Article> SelectAll()
        {
            using (DataAccessBroker broker = DataAccessFactory.Instance("onlyle"))
            {
                return DataAccess.SelectAll<E_GaoXiao_Article>(broker);
            }
        }

        public static List<E_GaoXiao_Article> Select(E_GaoXiao_Article GaoXiao_Article)
        {
            using(DataAccessBroker broker = DataAccessFactory.Instance())
            {
                return DataAccess.Select(GaoXiao_Article,broker);
            }
        }

        public static List<E_GaoXiao_Article> Select(int pageStartNum, int pageEndNum, string Type)
        {
            using (DataAccessBroker broke = DataAccessFactory.Instance())
            {
                DataAccessParameterCollection collection = new DataAccessParameterCollection();
                collection.AddWithValue("@pageStartNum", pageStartNum);
                collection.AddWithValue("@pageEndNum", pageEndNum);
                collection.AddWithValue("@DataType", Type);
                return DataAccess.SelectCommand<E_GaoXiao_Article>("GetGaoXiaoArticlePage", collection, broke);
            }
        }
        public static List<E_GaoXiao_Article> Select(int pageStartNum, int pageEndNum)
        {
            using (DataAccessBroker broke = DataAccessFactory.Instance())
            {
                DataAccessParameterCollection collection = new DataAccessParameterCollection();
                collection.AddWithValue("@pageStartNum", pageStartNum);
                collection.AddWithValue("@pageEndNum", pageEndNum);
                return DataAccess.SelectCommand<E_GaoXiao_Article>("GetGaoXiaoArticlePageForIndex", collection, broke);
            }
        }

        public static List<E_GaoXiao_Article> Select(E_GaoXiao_Article GaoXiao_Article, List<string> fieldNameList)
        {
            using(DataAccessBroker broker = DataAccessFactory.Instance())
            {
                return DataAccess.Select<E_GaoXiao_Article>(GaoXiao_Article,fieldNameList,broker);
            }
        }
        public static DataSet SelectDataSet(E_GaoXiao_Article GaoXiao_Article)
        {
            using(DataAccessBroker broker = DataAccessFactory.Instance())
            {
                return DataAccess.SelectDataSet(GaoXiao_Article,broker);
            }
        }

        public static List<E_GaoXiao_Article> SelectDayRecommendData(string type)
        {
            using (DataAccessBroker broke = DataAccessFactory.Instance())
            {
                DataAccessParameterCollection collection = new DataAccessParameterCollection();
                collection.AddWithValue("@GaoXiao_type", type);
                return DataAccess.SelectCommand<E_GaoXiao_Article>("DayRecommendData_GaoXiao", collection, broke);
            }
        }

        public static List<E_GaoXiao_Article> SelectGaoXiao_Detail(string key)
        {
            using (DataAccessBroker broke = DataAccessFactory.Instance())
            {
                DataAccessParameterCollection collection = new DataAccessParameterCollection();
                collection.AddWithValue("@Gaoxiao_PK", key);
                return DataAccess.SelectCommand<E_GaoXiao_Article>("GaoXiao_Detail", collection, broke);
            }
        }

        public static object GetGaoXiaoArticleCountByType(string type)
        {
            using (DataAccessBroker broke = DataAccessFactory.Instance())
            {
                DataAccessParameterCollection collection = new DataAccessParameterCollection();
                collection.AddWithValue("@DataType", type);
                return broke.ExecuteScalar("GetGaoXiaoArticleCountByType", collection, CommandType.StoredProcedure);
            }
        }
        public static object GetGaoXiaoArticleCountForIndex()
        {
            using (DataAccessBroker broke = DataAccessFactory.Instance())
            {
                string sql = "select COUNT(1) from GaoXiao_Article";
                DataAccessParameterCollection collection = new DataAccessParameterCollection();
                return broke.ExecuteScalar(sql, collection, CommandType.Text);
            }
        }

        public static List<E_GaoXiao_Article> SelectGaoXiaoForIndex()
        {
            using (DataAccessBroker broke = DataAccessFactory.Instance())
            {
                DataAccessParameterCollection collection = new DataAccessParameterCollection();
                return DataAccess.SelectCommand<E_GaoXiao_Article>("GetGaoXiaoForIndex", broke);
            }
        }
        
        #endregion

    }
}









